/*
 * socket.h
 *
 *  Created on: 22/05/2011
 *      Author: wadi
 */

#ifndef SOCKET_H_
#define SOCKET_H_

#include <string>
#include <netdb.h>

class Socket {
public:
    Socket();
    Socket(struct sockaddr_in adres,int id);
    virtual ~Socket();
    void closeSocket();
    virtual bool open()=0;
    virtual int recibir(unsigned char * buffer,int tamanioBuffer)=0;
    virtual int escribir(char * buffer,int cantidad)=0;
    bool isAvaliable();
    bool bindTo(int puerto);
protected:
    unsigned int socketId;
    struct sockaddr_in socketAddress;
    bool closed;
};

#endif /* SOCKET_H_ */
